package com.example.activiti.config.mapstruct;

import org.mapstruct.InheritConfiguration;
import org.mapstruct.InheritInverseConfiguration;

import java.util.List;

/**
 * @author Mr.yuan
 * @version v1.0
 * @date 2019/11/12 10:10
 **/
public interface BeanConverter<SOURCE,TARGET> {


    /**
     * 正向转换
     * @param source 数据源
     * @return TARGET
     */
    @InheritConfiguration
    TARGET sourceToTarget(SOURCE source);

    /**
     * 正向转换集合
     * @param sourceList 数据源
     * @return List<TARGET>
     */
    @InheritConfiguration
    List<TARGET> sourceToTargetList (List<SOURCE> sourceList);

    /**
     * 反向转换
     * @param target 数据源
     * @return SOURCE
     */
    @InheritInverseConfiguration
    SOURCE targetToSource(TARGET target);

    /**
     * 反向转换集合
     * @param targetList 数据源
     * @return List<SOURCE>
     */
    @InheritInverseConfiguration
    List<SOURCE> targetToSourceList (List<TARGET> targetList);

}
